import request from '@/utils/request'
import utils from '@/utils/util'

const portalApi = {
  // 角色分页查询
  getRoleListByPage(data) {
    const params = utils.dealGetData(data)
    return request.get('/api/inner/tenant/roles/page' + params)
  },
  // 角色新增
  addRole(data) {
    return request.post('/api/inner/tenant/role', data)
  },
  // 角色修改
  updateRole(data) {
    return request.put('/api/inner/tenant/role', data)
  },
  // 角色详情
  getRoleDetail(data) {
    const params = utils.dealGetData(data)
    return request.get('/api/inner/tenant/role' + params)
  },
  // 查询角色授权菜单
  getRoleMenuList(data) {
    const params = utils.dealGetData(data)
    return request.get('/api/inner/tenant/role/menus' + params)
  },

  // 查询商户所有菜单
  getMenuListByAuth() {
    return request.get('/api/inner/tenant/role/menuInfos')
  },
  // 角色授权菜单
  roleAuth(data) {
    return request.post('/api/inner/tenant/role/authorization', data)
  },
  // 上传图片
  uploadImg(data) {
    return request.post('/api/inner/portal/file/uploadImg', data)
  }
}

export default portalApi
